<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = [2, 0, 6, 1, 77, 0, 52, 0, 25, 7];
      var newArr = [];
      for (var i = 0; i < arr.length; i++) {
        if (arr[i] != 0) {
          newArr[newArr.length] = arr[i];
        }
      }
      console.log(newArr);	// 输出结果：(7) [2, 6, 1, 77, 52, 25, 7]
    </script>
  </body>
</html>